package com.tian.manage.api.feign;

import com.tian.common.domain.DomainConstant;
import com.tian.common.result.BaseResult;
import com.tian.common.result.Result;
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 *
 * <pre>
 *     后台用户
 * </pre>
 * @author zhumengping
 * @title: ManageUserFeign
 * @projectName zhump-cloud
 * @date 2023/8/1 16:42
 */
@FeignClient(name = DomainConstant.ZHUMP_MANAGE)
public interface ManageUserFeign {


    /**
    * <pre>
     *     获取后台管理用户列表
    * </pre>
    * @param
    * @return com.tian.common.result.BaseResult
    * @author zhump
    * @date 2023/8/1 16:56
    */
    @RequestMapping(value = "/manage/manageUser/getUserList",method = RequestMethod.POST)
    @CircuitBreaker(name = DomainConstant.ZHUMP_MANAGE,fallbackMethod = "getUserListHystrix")
    public BaseResult getUserList();


    /**
    * <pre>
     *     获取后台管理用户熔断
    * </pre>
    * @param throwable
    * @return com.tian.common.result.BaseResult
    * @author zhump
    * @date 2023/8/1 16:53
    */
    default BaseResult getUserListHystrix(Throwable throwable){
        return Result.error("manage服务异常,获取用户信息失败。。。");
    }
}
